﻿using System;
using Abp.Dependency;
using Abp.Reflection.Extensions;
using Hengyuantong.SmartRail.Configuration;
using Microsoft.Extensions.Configuration;

namespace Hengyuantong.SmartRail.Services.Implementations
{
    public class AppConfigurationAccessor : IAppConfigurationAccessor, ISingletonDependency
    {
        public IConfigurationRoot Configuration
        {
            get;
        }

        public AppConfigurationAccessor()
        {
            var env = Environment.GetEnvironmentVariable("LONGFORRISK_SERVICES_ENVIRONMENT");
            Configuration = AppConfigurations.Get(typeof(HengyuantongServicesModule).GetAssembly().GetDirectoryPathOrNull(), env);
        }
    }
}